package com.xxm.camera.camera2

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.xxm.databinding.ItemCamera2Binding

/**
 *Time:2023/6/13
 *Author:zhangwenshuan
 *Description:
 *since version
 *
 */
class Camera2Adapter : BaseQuickAdapter<NCameraInfo, Camera2Adapter.Camera2ViewHolder>() {
    override fun onBindViewHolder(holder: Camera2ViewHolder, position: Int, item: NCameraInfo?) {
        holder.bind(item)
    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): Camera2ViewHolder {
        val binding = ItemCamera2Binding.inflate(LayoutInflater.from(parent.context), parent, false);
        return Camera2ViewHolder(binding)
    }

    class Camera2ViewHolder(binding: ItemCamera2Binding) : RecyclerView.ViewHolder(binding.getRoot()) {
        var binding: ItemCamera2Binding

        init {
            this.binding = binding
        }

        fun bind(info: NCameraInfo?) {
            binding.camera = info
        }
    }
}